<%@ taglib prefix="s" uri="http://www.springframework.org/tags" %>
<%--
  ~ Copyright (c) 2017. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
  ~ Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
  ~ Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
  ~ Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
  ~ Vestibulum commodo. Ut rhoncus gravida arcu.
  --%>

<%--
  Created by IntelliJ IDEA.
  User: lenovo
  Date: 2017/5/22
  Time: 11:29
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <jsp:include page="../../head.jsp"/>
    <title>基础数据维护</title>
    <script type="text/javascript">
        var formSetting = {
            title: "",
            module: 'save',
            numCount: '1',
            columns: [{
                index: "ID",
                name: "id",
                label: "id",
                hidden: true
            }, {
                index: "parentId",
                name: "parentId",
                label: "父字典组",
                type: "dropdown",
                dropdownType: "ajax",
                url: "<s:url value='dropdownData'/>",
                op: "eq",
                minLength: 0,
                keyWordName: "key",
                success: function (data) {
                    var array = new Array();
                    $.each(data, function (i, n) {
                        array.push([n["name"], n["id"]]);
                    });
                    return array;
                }
            }, {
                index: "code",
                name: "code",
                label: "代码"
            }, {
                index: "name",
                name: "name",
                label: "名称"
            }, {
                index: "decript",
                name: "decript",
                label: "描述",
                type: "textarea"
            }, {
                index: "status",
                name: "status",
                label: "状态",
                type: "dropdown",
                data: [["注销", "0"], ["启用", "1"]],
                op: "eq",
                minLength: 0
            }],
            form: {
                'url': 'saveOrUpdate',
                'data': function () {
                    var id = "${param.dtgId}";
                    var dataValue = "";
                    $.ajax({
                               url: "selectByPkey?dtgId=" + id,
                               async: false,
                               success: function (data) {
                                   dataValue = data;
                               }
                           });
                    return dataValue;
                },
                'ajaxForm': {
                    success: function (result) {
                        parent.layer.msg(result.msg);
                        parent.reloadGridData();
//                        location.herf = "add?dtgId=" + result.data;
                        parent.layer.closeAll();
                    }
                }
            },
            buttons: {
                custom: []
            }
        };
        $(document).ready(function () {
            $("#dictionaryDataTable").mrdForm(formSetting);
        });
    </script>
    <style type="text/css">
        .ui-autocomplete{
            max-height: 198px;
            overflow-y: auto;
        }
    </style>
</head>
<body>
<div id="dictionaryDataTable"></div>
</body>
</html>
